<template>
  <div style="height: 50vh; display: flex; justify-content: center; align-items: center; ">
    <el-card class="no-border" style="width: 50%; display: flex; justify-content: center; align-items: center;">
      <div style="font-size: 20px;font-weight: bold;text-align: center;margin-bottom: 20px">
       输入手机号查询票务
      </div>
      <el-form>
        <el-form-item style="width:400px" >
          <el-input  v-model="phone" placeholder="请输入手机号"></el-input>
        </el-form-item>
       <div style="display: flex;justify-content: center;align-items: center;">
         <el-button type="primary" @click="select">查询</el-button>
       </div>
      </el-form>
    </el-card>
  </div>

</template>

<script>
import request from "@/utils/request";
import {ElMessage} from "element-plus";

export default {
  name: "SelectWriteOff",

  data() {
    return {
      phone: '',

    }
  },
  methods: {
    select() {
      if (this.validatePhone(this.phone)) {
        this.$router.push({ name: 'WriteOff', params: { phone: this.phone } });
      } else {
        ElMessage.error('请输入有效的手机号');
      }
    },
    validatePhone(phone) {
      const phoneRegex = /^1[3-9]\d{9}$/;
      return phoneRegex.test(phone);
    }
  }

}


</script>

<style scoped>

</style>